
    <!DOCTYPE html>
    <html lang="zh-CN">
    <head>
      <meta charset="UTF-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <title>Linux 系统故障排查与日志分析 - 学习卡片</title>
      <style>
        body { font-family: sans-serif; background-color: #f0f8ff; color: #333; display: flex; flex-direction: column; align-items: center; padding: 50px 20px; }
        .header h1 { font-size: 32px; }
        .grid-container { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; max-width: 1200px; }
        .card-container { perspective: 1200px; cursor: pointer; height: 250px; }
        .card { width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform 0.7s; border-radius: 16px; box-shadow: 0 4px 16px rgba(0,0,0,0.08); }
        .card-container.flipped .card { transform: rotateY(180deg); }
        .card-face { position: absolute; width: 100%; height: 100%; backface-visibility: hidden; display: flex; flex-direction: column; box-sizing: border-box; border-radius: 16px; background-color: #fff; padding: 24px; }
        .card-back { background-color: #f0fff4; transform: rotateY(180deg); justify-content: space-between; }
        .card-category { font-size: 14px; color: #0052d9; margin-bottom: 8px; font-weight: 500; }
        .card-question { font-size: 20px; font-weight: 500; flex-grow: 1; display: flex; align-items: center; justify-content: center; text-align: center; }
        .card-answer-wrapper { flex-grow: 1; overflow-y: auto; }
        .card-answer { font-size: 15px; line-height: 1.7; }
        .card-footer { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 16px; margin-top: 16px; }
        .card-source { font-size: 13px; color: #8a919f; border-top: 1px solid #f0f0f0; padding-top: 12px; margin-top: 12px; }
      </style>
    </head>
    <body>
      <div class="header">
        <h1>Linux 系统故障排查与日志分析 - 学习卡片</h1>
      </div>
      <div class="grid-container">
        
    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">文档中提到的“黄金五连击”是哪五个用于快速检查系统状态的命令？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">1. `top -c -n 1`：实时监控进程（带完整命令）。<br>2. `dmesg | tail -20`：查看最近的内核日志。<br>3. `journalctl -xe -n 50`：查看最后50条系统日志（带详细解释）。<br>4. `netstat -tulnp`：查看端口占用情况。<br>5. `df -hT`：检查磁盘空间（带文件系统类型）。</div>
          </div>
          <div class="card-source">来源: 1.1 系统状态速查表</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在排查Java应用问题时，有哪些专用的JDK工具可以用来查看JVM状态？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档中列举了三个Java专用检测工具：<br>1. `jps -mlv`：用于列出所有Java进程。<br>2. `jstat -gcutil <PID>`：用于查看指定进程的内存GC情况。<br>3. `jstack <PID>`：用于生成指定进程的线程堆栈快照。</div>
          </div>
          <div class="card-source">来源: 1.2 Java专用检测工具</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">在分析日志文件时，`zgrep` 和 `grep -C 5` 这两个命令分别适用于什么场景？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">`zgrep` 用于直接搜索被压缩过的日志文件（历史日志归档）。`grep -C 5` 用于在搜索时显示匹配行及其前后各5行的内容，便于查看异常的上下文信息。</div>
          </div>
          <div class="card-source">来源: 2.1 日志查看技巧</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">机制</div>
          <div class="card-question">文档中的Logstash配置示例是如何处理Java多行堆栈跟踪日志的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">机制</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">它通过 `multiline` 编解码器（codec）来处理。配置 `pattern => "^%{TIMESTAMP_ISO8601} "`、`negate => true` 和 `what => previous`，意味着任何不以标准时间戳开头的行都会被合并到前一行，从而将完整的堆栈跟踪组合成一个日志事件。</div>
          </div>
          <div class="card-source">来源: 2.2 ELK日志分析平台搭建</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">当怀疑Java应用存在内存泄漏时，应使用哪个命令来生成堆内存转储（heap dump）文件？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">应使用 `jmap -dump:live,format=b,file=heap.hprof <PID>` 命令。该命令会生成一个只包含存活对象的二进制格式（format=b）的堆转储文件，名为 heap.hprof。</div>
          </div>
          <div class="card-source">来源: 3.2 内存泄漏定位</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">理论</div>
          <div class="card-question">文档指出了Java网络编程中的哪些常见问题？请列举至少三个。</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">理论</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">文档列举了四个常见问题：<br>1. Socket未关闭导致文件描述符耗尽。<br>2. DNS缓存未及时刷新。<br>3. 连接池配置不当。<br>4. 未处理TCP Keep-Alive。</div>
          </div>
          <div class="card-source">来源: 4.2 Java网络编程常见问题</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">技术</div>
          <div class="card-question">如何检查一个特定进程（PID）打开了多少个文件描述符？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">技术</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">可以通过执行命令 `ls -l /proc/<PID>/fd | wc -l` 来统计指定进程打开的文件描述符数量。</div>
          </div>
          <div class="card-source">来源: 5.2 文件描述符泄漏排查</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">模式</div>
          <div class="card-question">在电商大促故障排查案例中，是如何初步判断瓶颈在于Java应用而不是系统问题的？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">模式</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">通过执行 `top` 命令，发现CPU使用率中用户态（us）占比高达80.3%，这表明是应用程序（即Java应用）消耗了大量CPU资源，而不是操作系统内核或硬件问题。</div>
          </div>
          <div class="card-source">来源: 6.2 排查过程</div>
        </div>
      </div>
    </div>

    <div class="card-container" onclick="this.classList.toggle('flipped');">
      <div class="card">
        <div class="card-face card-front">
          <div class="card-category">特性</div>
          <div class="card-question">文档中展示的Java `try-with-resources` 代码示例，其主要目的是什么？</div>
          <div class="card-footer">点击卡片查看答案</div>
        </div>
        <div class="card-face card-back">
          <div class="card-category">特性</div>
          <div class="card-answer-wrapper">
            <div class="card-answer">其主要目的是实现资源的自动关闭。通过将 `Socket` 和 `OutputStream` 等资源在 `try` 关键字后的括号内初始化，可以确保在 `try` 块执行完毕后，这些资源会被自动调用 `close()` 方法，从而有效防止因忘记关闭资源而导致的泄露问题。</div>
          </div>
          <div class="card-source">来源: 4.2 Java网络编程常见问题</div>
        </div>
      </div>
    </div>

      </div>
    </body>
    </html>
